import axios from 'axios';

// let baseURL = 'http://192.168.3.71:8080/syndicationManage/api/loanApply';

let baseURL = 'http://report.wsloan.com:8888/syndication/api/loanApply'

let httpInstance = axios.create({
  baseURL: baseURL,
  timeout: 1500,
  transformRequest: [function (data) {
    // 对 data 进行任意转换处理

    return data;
  }],
  transformResponse: [function (data) {
    // 对 data 进行任意转换处理

    return data;
  }],
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
  }
});

httpInstance.interceptors.request.use(function (config) {
  console.log('请求开始...');
  return config;
}, function (error) {
  console.log('发送请求前错误信息', error);
  return Promise.reject(error);
});

httpInstance.interceptors.response.use(function (config) {
  console.log(config);
  console.log('请求结束...');
  return config;
}, function (error) {
  console.log('请求返回后错误信息', error);
  return Promise.reject(error);
});

export default httpInstance
